package archiving.gui;

import gui.util.CheckboxTreeCellRenderer;
import gui.util.FileCheckBox;
import gui.util.FileTreeNode;
import gui.util.FileTreeNodeCellRenderer;
import gui.util.event.CheckboxMouseListener;
import gui.util.event.FileTreeNodeMouseListener;

import java.io.File;

import javax.swing.JFrame;
import javax.swing.JTree;
import javax.swing.JScrollPane;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.tree.DefaultMutableTreeNode;

public class FileTreeTest2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		JFrame frame = new JFrame("JTree with added observing checkboxes");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Root Node
		
		FileTreeNode root = new FileTreeNode(new File("c:\\"));
		
//		
//		for (File file : rootFile.listFiles()) {
//			FileCheckBox slave = new FileCheckBox(file);
//			root.addSlave(slave);
//			
//			DefaultMutableTreeNode node = new DefaultMutableTreeNode(slave);
//			rootNode.add(node);
//		}
		

		JTree tree = new JTree(root);
		tree.setCellRenderer(new FileTreeNodeCellRenderer());
		tree.addMouseListener(new FileTreeNodeMouseListener());
		
		frame.add(new JScrollPane(tree));
				
		frame.pack();
		frame.setVisible(true);
	}
}
